# !/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# @Time: 2021/3/21 11:40

import configparser
import os

config_file = 'config/config_dynamic.ini'

class ConfigDynamic(object):

    def get(self, section, name):
        path = os.path.join(os.getcwd(), config_file)
        config = configparser.ConfigParser()
        config.read(path, encoding='utf-8-sig')
        return config.get(section, name)

    def set(self,section,name,value):
        path = os.path.join(os.getcwd(), config_file)
        config = configparser.ConfigParser()
        config.read(path, encoding='utf-8-sig')
        config.set(section,name,value)
        with open(path,'w') as fw:
            config.write(fw)
    

config_dynamic = ConfigDynamic()

# config_dynamic.set('config','enable_atall','false')
# a = config_dynamic.get('config','enable_atall')